package com.server.commons.file.model.input;

import com.server.model.all.enums.BucketNameEnum;
import com.server.model.all.enums.BusinessNameEnum;
import com.server.common.code.utils.DateUtil;
import lombok.*;


@Getter
@Setter
public class UploadFileInput {

    private BucketNameEnum bucketNameEnum;

    /**
     * 流文件  必填
     * @author LXC
     * @date 2023/2/6 8:51
     */
    private byte[] bytes;

    /**
     * 路径(不包含桶名)
     * @author LXC
     * @date 2023/2/8 21:27
     */
    private String path;

    //用户编码 *
    private String userCode;
    //功能名 *
    private BusinessNameEnum businessNameEnum;
    //文件编码 *
    private String fileCode;
    //后缀名 *
    private String suffix;

    public String getDir(){
        return getBusinessNameEnum().getName()
                +"/"
                + getUserCode()
                +"/"
                + DateUtil.year(DateUtil.date())
                + "/"
                + DateUtil.month(DateUtil.date())
                + "/"
                + DateUtil.dayOfMonth(DateUtil.date());
    }

    public String getFileFullPath(){
        return getDir()
                + "/"
                + getFileCode()
                + "."
                + getSuffix();
    }

}
